| Conditions | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | // eslint-disable-next-line import/no-commonjs |
||
| 10 | function preventParentScopeModules() { |
||
| 11 | const nodeModulePaths = Module._nodeModulePaths; // backup the original method |
||
| 12 | |||
| 13 | Module._nodeModulePaths = function (from) { |
||
| 14 | let paths = nodeModulePaths.call(this, from); // call the original method |
||
| 15 | |||
| 16 | // add your logic here to exclude parent dirs, I did a simple match with current dir |
||
| 17 | paths = paths.filter(function (path) { |
||
| 18 | return path.match(__dirname); |
||
| 19 | }); |
||
| 20 | |||
| 21 | return paths; |
||
| 22 | }; |
||
| 23 | } |
||
| 24 | |||
| 27 |